/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cpasl;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;

/**
 *
 * @author seanm_000
 */
public class AgeGridPane extends GridPane {
    
    public AgeGridPane() {
        setAlignment(Pos.CENTER);
        setHgap(15);
        setVgap(15);
        
        Label ageLabel = new Label("Please enter your age.  Leave blank, if you prefer not to answer.");
        add(ageLabel, 0, 0);
        final TextField ageTextField = new TextField();
        add(ageTextField, 0, 1);
        
        Button nextButton = new Button();
        nextButton.setText("Next");
        nextButton.setId("next-button");
        nextButton.setOnAction(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent event) {
               CpaslManager.getInstance().setAge(ageTextField.getText());
               CpaslManager.getInstance().switchToDisplay(Groups.GENDER, 0);
            }
        });
        add(nextButton, 0, 2);
        
        
    }
    
}
